#ifndef _SHADER_MANAGER_SHADER_
#define _SHADER_MANAGER_SHADER_

#include "smUniform.h"
#include "smTexture.h"

#include <vector>
#include <string>

#include <GL/glew.h>

namespace ShaderManager
{

class smShader
{
public:

	smShader(
		const char* vertex_shader_name, 
		const char* fragment_shader_name);

	smShader(
		const char* vertex_shader_name,
		const char* tesselation_control_shader_name,
		const char* tesselation_evaluation_shader_name,
		const char* geometry_shader_name,
		const char* fragment_shader_name);

	~smShader();

	void Activate();
	void Deactivate();
	void LoadProgram();

// shader uniform variables
public:
	void addUniform1i(const char* uniform_name, const int* val);
	void addUniform1iv(const char* uniform_name, const int* val, const int size);
	void addUniform1f(const char* uniform_name, const float *val);
	void addUniform1fv(const char* uniform_name, const float *val, const int size);
	void addUniform3f(const char* uniform_name, const float tab[3]);
	void addUniformMatrix3f(const char* uniform_name, const float tab[9]);
	void addUniformMatrix4f(const char* uniform_name, const float tab[16]);

// shader texture
public:
	void addTexture(smTexture* smtexture);

private:
	GLuint program_id;

private:
	std::vector<smUniform*> uniform;
	std::vector<smTexture*> texture;

private:
	const std::string vertex_shader_path;
	const std::string tessellation_control_shader_path;
	const std::string tessellation_evaluation_shader_path;
	const std::string geometry_shader_path;
	const std::string fragment_shader_path;

	/* charge un shader */
	GLuint LoadShader(GLenum type, const std::string& filename);
};

}

#endif